<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>图片弹窗</title>
    <style>
      img {
        width: 30%;
        transition: all 2s;
      }

      /* img:hover{
            transform: scale(2);
        } */
      div {
        text-align: center;
      }

      .dialog {
        display: none;
        background: black;
        top: 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
      }

      .dialog > div {
        /* background-color: blanchedalmond; */
        /* padding-bottom: 20%; */
        margin: auto;
        height: 60%;
        width: 80%;
        padding-top: 10%;
      }
      .dialog img {
        transform: scale(0);
        width: 50%;
        height: 50%;
        transition: all 2s;
      }
    </style>
  </head>

  <body>
    <div>
      <img src="../../img/img1.jpg" alt="" onclick="doit()" id="im1" />
    </div>
    <div class="dialog" id="dia">
      <div>
        <img src="../../img/img1.jpg" alt="" id="im2" />
      </div>
      <!-- <div class="text" style="color: #ffffff;">文本信息</div> -->
    </div>
    <script>
      let dia = document.getElementById("dia");
      let img2 = document.getElementById("im2");
      function doit() {
        dia.style.display = "block";
        setTimeout(()=>{
            im2.style.transform = "scale(1.5)";
        })
      }
      dia.onclick = function () {
        im2.style.transform = "scale(0)";
        this.style.display = "none";
      };
    </script>
  </body>
</html>
